debugger
let label = $(泵站选择.id).combobox('getValue');
let text = $(泵站选择.id).combobox('getText');
let tagMap = {
    "total": ["YD_ANP_A_FIT_I_L", "YD_ANP_B_FIT_I_L", "YD_ANP_C_FIT_I_L", "YD_ANP_D_FIT_I_L", "YD_ANP_E_FIT_I_L", "YD_ANP_F_FIT_I_L", "YD_GRT_FIT_O_L", "YD4_GRT_EO_FIT_TotalValue", "YD4_GRT_WO_FIT_TotalValue", "YD4_FIT408_01_PauseValue", "123zll", "1234zll", "4zll"],
    "22": ["YD4_FT_01_Out", "YD4_FT_02_Out", "YD4_FT_03_Out", "YD4_FT_04_Out", "YD4_FT_05_Out", "YD4_FT_06_Out", "YD4_FT_07_Out", "YD4_FT_08_Out", "YD4_FT_WDT_LIT_Out", "YD4_FT_CWT_LIT_Out"],
    "23": ["YD4_FT_JS_N03N_Out", "YD4_FT_CS_N03N_Out", "YD4_HST_NO3N_PV_Out", "YD4_FT_JS_DO_Out", "YD4_FT_JS_FIT_Out", "YD4_FT_PIT006_Out", "YD4_FT_PIT002_Out", "YD4_FT_FXS_FIT_Out", "YD4_FT_JS_N03N", "YD4_FT_CS_N03N", "YD4_FT_JS_DO", "YD4_FT_JS_FIT", "YD4_FT_Dosage"],
    "24": ["YD4_FT_SBP_FSP01_DI_RUN", "YD4_FT_SBP_FSP02_DI_RUN", "YD4_FT_SBP_FSP03_DI_RUN", "YD4_FT_SBP_P01_DI_RUN", "YD4_FT_SBP_P02_DI_RUN", "YD4_FT_SBP_P03_DI_RUN", "YD4_FT_MIX_WDT_DI_RUN", "YD4_FT_MIX_CWT_DI_RUN"],
    "25": ["YD4_BBH_RBL_BA_HSpSpd", "YD4_BBH_RBL_BA_I", "YD4_BBH_RBL_BA_Fr", "YD4_BBH_RBL_BA_Power", "YD4_BBH_RBL_BB_HSpSpd", "YD4_BBH_RBL_BB_I", "YD4_BBH_RBL_BB_Fr", "YD4_BBH_RBL_BB_Power", "YD4_BBH_RBL_BC_HSpSpd", "YD4_BBH_RBL_BC_I", "YD4_BBH_RBL_BC_Fr", "YD4_BBH_RBL_BC_Power", "YD4_BBH_RBL_BD_HSpSpd", "YD4_BBH_RBL_BD_I", "YD4_BBH_RBL_BD_Fr", "YD4_BBH_RBL_BD_Power", "YD4_FT_RBL_B01_Current_Out", "YD4_FT_RBL_B02_Current_Out", "YD4_FT_RBL_B03_Current_Out"],
    "26": ["YD4_BH_RBL_BA_HSpSpd", "YD4_BH_RBL_BA_I", "YD4_BH_RBL_BA_Fr", "YD4_BH_RBL_BA_Power", "YD4_BH_RBL_BB_HSpSpd", "YD4_BH_RBL_BB_I", "YD4_BH_RBL_BB_Fr", "YD4_BH_RBL_BB_Power", "YD4_BH_RBL_BC_HSpSpd", "YD4_BH_RBL_BC_I", "YD4_BH_RBL_BC_Fr", "YD4_BH_RBL_BC_Power", "YD4_BH_RBL_BD_HSpSpd", "YD4_BH_RBL_BD_I", "YD4_BH_RBL_BD_Fr", "YD4_BH_RBL_BD_Power", "YD4_BH_RBL_BE_HSpSpd", "YD4_BH_RBL_BE_I", "YD4_BH_RBL_BE_Fr", "YD4_BH_RBL_BE_Power", "YD4_BH_RBL_BF_HSpSpd", "YD4_BH_RBL_BF_I", "YD4_BH_RBL_BF_Fr", "YD4_BH_RBL_BF_Power", "YD4_BH_RBL_BH_HSpSpd", "YD4_BH_RBL_BH_I", "YD4_BH_RBL_BH_Fr", "YD4_BH_RBL_BH_Power", "YD4_BH_RBL_BG_HSpSpd", "YD4_BH_RBL_BG_I", "YD4_BH_RBL_BG_Fr", "YD4_BH_RBL_BG_Power"],
    "27": ["YD4_BBH_RBL_BA_DI_RUN", "YD4_BBH_RBL_BB_DI_RUN", "YD4_BBH_RBL_BC_DI_RUN", "YD4_BBH_RBL_BD_DI_RUN", "YD4_FT_RBL_B01_DI_RUN", "YD4_FT_RBL_B02_DI_RUN", "YD4_FT_RBL_B03_DI_RUN"],
    "28": ["YD4_BH_RBL_BA_DI_RUN", "YD4_BH_RBL_BB_DI_RUN", "YD4_BH_RBL_BC_DI_RUN", "YD4_BH_RBL_BD_DI_RUN", "YD4_BH_RBL_BE_DI_RUN", "YD4_BH_RBL_BF_DI_RUN", "YD4_BH_RBL_BG_DI_RUN", "YD4_BH_RBL_BH_DI_RUN"],
    "29": ["YD4_PAC_JY_CG1_YW", "YD4_PAC_JY_CG2_YW", "YD4_PAC_JY_LLJ1", "YD4_PAC_JY_LLJ1_LJ", "YD4_PAC_JY_LLJ2", "YD4_PAC_JY_LLJ2_LJ"],
    "30": ["YD4_PAC_JY_VLP_P01_DI_RUN", "YD4_PAC_JY_VLP_P02_DI_RUN", "YD4_PAC_JY_VLP_P03_DI_RUN", "YD4_PAC_JY_XSSB_P01_DI_RUN", "YD4_PAC_JY_XSSB_P02_DI_RUN", "YD4_PAC_JY_XSSB_P03_DI_RUN", "YD4_PAC_JY_MIX_M01_DI_RUN", "YD4_PAC_JY_MIX_M02_DI_RUN"],
    "31": [ "YD4_YSN_CG1_YW", "YD4_YSN_CG2_YW", "YD4_YSN_LLJ1", "YD4_YSN_LLJ1_LJ", "YD4_YSN_LLJ2", "YD4_YSN_LLJ2_LJ", "YD4_YSN_LLJ3", "YD4_YSN_LLJ3_LJ", "YD4_YSN_LLJ4", "YD4_YSN_LLJ4_LJ", "YD4_YSN_LLJ5", "YD4_YSN_LLJ5_LJ", "YD4_YSN_LLJ6", "YD4_YSN_LLJ6_LJ"],
    // "31": ["YD4_PAC_JY_CG1_YW", "YD4_PAC_JY_CG2_YW", "YD4_PAC_JY_LLJ1",  "YD4_PAC_JY_LLJ2",  "YD4_YSN_CG1_YW", "YD4_YSN_CG2_YW", "YD4_YSN_LLJ1",  "YD4_YSN_LLJ2",  "YD4_YSN_LLJ3",  "YD4_YSN_CG1_YW", "YD4_YSN_CG2_YW", "YD4_YSN_LLJ4", "YD4_YSN_LLJ5",  "YD4_YSN_LLJ6"],
    "10": ["YD4_MBR_W_DO_01_PV_Out", "YD4_MBR_W_DO_02_PV_Out", "YD4_MBR_W_DO_03_PV_Out", "YD4_MBR_W_DO_04_PV_Out", "YD4_MBR_W_DO_05_PV_Out", "YD4_MBR_W_ORP_01_PV_Out", "YD4_MBR_W_ORP_02_PV_Out", "YD4_MBR_W_ORP_03_PV_Out", "YD4_MBR_W_MLSS_PV_Out", "YD4_MBR_W_NO3_PV_Out", "YD4_MBR_W_FIT_AIR_01_PV_Out", "YD4_MBR_W_FIT_AIR_02_PV_Out", "YD4_MBR_W_FIT_AIR_03_PV_Out", "YD4_MBR_W_FIT_AIR_04_PV_Out", "YD4_MBR_W_FIT_AIR_05_PV_Out", "YD4_ABH_WO_PIT_AIR_PV_Out", "YD4_ABH_WO_FIT_AIR_PV_Out", "YD4_ABH_WO_FIT_AIR_TotalValue"],
    "32": ["YD4_YSN_VLP_P01_DI_RUN", "YD4_YSN_VLP_P02_DI_RUN", "YD4_YSN_VLP_P03_DI_RUN", "YD4_YSN_VLP_P04_DI_RUN", "YD4_YSN_VLP_P05_DI_RUN", "YD4_YSN_VLP_P06_DI_RUN", "YD4_YSN_VLP_P07_DI_RUN", "YD4_YSN_VLP_P08_DI_RUN"],
    "11": ["YD4_MBR_W_MIX_01_DI_RUN", "YD4_MBR_W_MIX_02_DI_RUN", "YD4_MBR_W_MIX_03_DI_RUN", "YD4_MBR_W_MIX_04_DI_RUN", "YD4_MBR_W_MIX_05_DI_RUN", "YD4_MBR_W_MIX_06_DI_RUN", "YD4_MBR_W_MIX_07_DI_RUN", "YD4_MBR_W_MIX_08_DI_RUN", "YD4_MBR_W_MIX_09_DI_RUN", "YD4_MBR_W_MIX_10_DI_RUN", "YD4_MBR_W_MIX_11_DI_RUN", "YD4_MBR_W_MIX_12_DI_RUN", "YD4_MBR_W_IRP_01_DI_RUN", "YD4_MBR_W_IRP_02_DI_RUN", "YD4_MBR_W_IRP_03_DI_RUN"],
    "33": ["YD4_YSN_CG3_YW", "YD4_YSN_CG4_YW", "YD4_YSN_LLJ9", "YD4_YSN_LLJ9_LJ", "YD4_YSN_LLJ10", "YD4_YSN_LLJ10_LJ", "YD4_YSN_LLJ11", "YD4_YSN_LLJ11_LJ", "YD4_YSN_LLJ13", "YD4_YSN_LLJ13_LJ", "YD4_YSN_LLJ14", "YD4_YSN_LLJ14_LJ"],
    // "33": ["YD4_YSN_CG3_YW", "YD4_YSN_CG4_YW", "YD4_YSN_LLJ9", "YD4_YSN_LLJ10",  "YD4_YSN_LLJ11",  "YD4_YSN_CG3_YW", "YD4_YSN_CG4_YW", "YD4_YSN_LLJ13",  "YD4_YSN_LLJ14"],
    "12": ["YD4_SST_EL_PV_Out", "YD4_SST_E_RSP_FIT_PV_Out", "YD4_SST_E_RSP_FIT_TotalValue", "YD4_SST_E_ESP_FIT_PV_Out", "YD4_SST_E_ESP_FIT_TotalValue", "YD4_SST_WL_PV_Out", "YD4_SST_W_RSP_FIT_PV_Out", "YD4_SST_W_RSP_FIT_TotalValue", "YD4_SST_W_ESP_FIT_PV_Out", "YD4_SST_W_ESP_FIT_TotalValue"],
    "34": ["YD4_YSN_VLP_P09_DI_RUN", "YD4_YSN_VLP_P10_DI_RUN", "YD4_YSN_VLP_P11_DI_RUN", "YD4_YSN_VLP_P12_DI_RUN", "YD4_YSN_VLP_P13_DI_RUN", "YD4_YSN_VLP_P14_DI_RUN", "YD4_YSN_VLP_P15_DI_RUN"],
    "13": ["YD4_SST_E_ESP_01_DI_RUN", "YD4_SST_E_ESP_02_DI_RUN", "YD4_SST_E_IRP_W01_DI_RUN", "YD4_SST_E_IRP_W02_DI_RUN", "YD4_SST_E_IRP_W03_DI_RUN", "YD4_SST_W_ESP_01_DI_RUN", "YD4_SST_W_ESP_02_DI_RUN", "YD4_SST_W_IRP_W01_DI_RUN", "YD4_SST_W_IRP_W02_DI_RUN", "YD4_SST_W_IRP_W03_DI_RUN"],
    // "35": ["YD4_XGS_PAC_CG_YW", "YD4_XGS_PAC_LL", "YD4_XGS_PAC_LL_LJ", "YD4_CLSN_CG1_YW", "YD4_CLSN_CG2_YW", "YD4_CLSN_LLJ", "YD4_CLSN_LLJ_LJ", "YD4_PAM_FIT_01", "YD4_PAM_FIT_01_LJ", "YD4_PAM_FIT_02", "YD4_PAM_FIT_02_LJ", "YD4_FM_PAC_CG_YW", "YD4_FM_PAC_LCWD", "YD4_FM_PAC_LLJ", "YD4_FM_PAC_LLJ_LJ"],
    "35": ["YD4_XGS_PAC_CG_YW", "YD4_XGS_PAC_LL", "YD4_CLSN_CG1_YW", "YD4_CLSN_CG2_YW", "YD4_CLSN_LLJ",  "YD4_PAM_FIT_01", "YD4_PAM_FIT_02", "YD4_FM_PAC_CG_YW", "YD4_FM_PAC_LCWD", "YD4_FM_PAC_LLJ"],
    "14": ["YD4_BAF_IPH_EU", "YD4_BAF_INH3N_EU", "YD4_BAF_ONH3N_EU", "YD4_BAF_LBLC_LIT_EU", "YD4_BAF_FCX_FIT_EU", "YD4_BAF_FCX_LIT_EU", "YD4_BAF_PITA_EU", "YD4_BAF_PITB_EU", "YD4_BAF_PITC_EU", "YD4_BAF_PITD_EU", "YD4_BAF_PITE_EU", "YD4_BAF_PITF_EU"],
    "36": ["YD4_XGS_PAC_VLP_P01_DI_RUN", "YD4_XGS_PAC_VLP_P02_DI_RUN", "YD4_XGS_PAC_MIX_M01_DI_RUN", "YD4_CLSN_VLP_P01_DI_RUN", "YD4_CLSN_VLP_P02_DI_RUN", "YD4_PAM_TJB_P01_DI_RUN", "YD4_PAM_TJB_P02_DI_RUN", "YD4_PAM_TJB_P03_DI_RUN"],
    "15": ["YD4_BAF_CFP_BQT_P01_DI_RUN", "YD4_BAF_CFP_BQT_P02_DI_RUN", "YD4_BAF_CFP_P01_DI_RUN", "YD4_BAF_CFP_P02_DI_RUN", "YD4_BAF_CFP_P03_DI_RUN", "YD4_BAF_CFP_P04_DI_RUN"],
    "37": ["YD4_DEO_JK_H2S", "YD4_DEO_JK_NH3", "YD4_DEO_JK_CH4", "YD4_DEO_CK_H2S", "YD4_DEO_CK_NH3", "YD4_DEO_CK_CH4", "YD4_DEO_XDTCK_H2S", "YD4_DEO_XDTCK_NH3", "YD4_DEO_JYG_LIT", "YD4_DEO_JX_PH", "YD4_DEO_PS_PH"],
    "16": ["YD4_BAF_SR_M01_BL_Out", "YD4_BAF_SR_M01_Out", "YD4_BAF_SR_M01_YEC", "YD4_BAF_SR_CXSB_PIT", "YD4_LPS_LIT_PV_Out"],
    "38": ["YD4_DEO_JXB_P01_DI_RUN", "YD4_DEO_JXB_P02_DI_RUN", "YD4_DEO_SXSB_P01_DI_RUN", "YD4_DEO_SXSB_P02_DI_RUN", "YD4_DEO_VLP_P01_DI_RUN", "YD4_DEO_VLP_P02_DI_RUN", "YD4_DEO_PSB_P01_DI_RUN", "YD4_DEO_CBL_B01_DI_RUN"],
    "17": ["YD4_BAF_SR_NJL01_DI_RUN", "YD4_BAF_SR_NJL02_DI_RUN", "YD4_BAF_SR_CXSB01_C_F", "YD4_BAF_SR_CXSB02_C_F"],
    "39": ["YD4_DEO1_JK_H2S", "YD4_DEO1_JK_NH3", "YD4_DEO1_JK_CH4", "YD4_DEO1_CK_H2S", "YD4_DEO1_CK_NH3", "YD4_DEO1_CK_CH4", "YD4_DEO1_XDTCK_H2S", "YD4_DEO1_XDTCK_NH3", "YD4_DEO1_JYG_LIT", "YD4_DEO1_JX_PH", "YD4_DEO1_PS_PH"],
    "18": ["YD4_LPS_LIT_PV_Out", "YD4_LPS_SBP_P01_Current", "YD4_LPS_SBP_P01_V_FRQ", "YD4_LPS_SBP_P02_Current", "YD4_LPS_SBP_P02_V_FRQ", "YD4_LPS_SBP_P03_Current", "YD4_LPS_SBP_P03_V_FRQ", "YD4_LPS_SBP_P04_Current", "YD4_LPS_SBP_P04_V_FRQ", "YD4_LPS_SBP_P05_Current", "YD4_LPS_SBP_P05_V_FRQ", "YD4_LPS_SBP_P06_Current", "YD4_LPS_SBP_P06_V_FRQ", "YD4_SST_EAV_V01_V_ZIT", "YD4_SST_EAV_V02_V_ZIT"],
    "19": ["YD4_LPS_SBP_P01_DI_RUN", "YD4_LPS_SBP_P02_DI_RUN", "YD4_LPS_SBP_P03_DI_RUN", "YD4_LPS_SBP_P04_DI_RUN", "YD4_LPS_SBP_P05_DI_RUN", "YD4_LPS_SBP_P06_DI_RUN"],
    "1": ["YD4_MIR_COD_PV_Out", "YD4_MIR_NH3N_PV_Out", "YD4_MIR_TP_PV_Out", "YD4_MIR_TN_PV_Out", "YD4_MIR_CIT_PV_Out", "YD4_MIR_PH_PV_Out", "YD4_GRT_WO_FIT_PV_Out", "YD4_GRT_WO_FIT_TotalValue", "YD4_GRT_EO_FIT_PV_Out", "YD4_GRT_EO_FIT_TotalValue", "YD_DFP_COD", "YD_DFP_NH3", "YD_DFP_TP", "YD_DFP_OMR_TN", "YD_DFP_SS", "YD_DFP_PH", "YD4_FIT408_01_PV_Out", "YD4_FIT408_01_PauseValue"],
    "2": ["YD4_IPS_CSR_FL_Out", "YD4_IPS_CSR_M01_BL_Out", "YD4_IPS_CSR_M02_BL_Out", "YD4_IPS_FSR_M01_FL_Out", "YD4_IPS_FSR_M02_FL_Out", "YD4_IPS_FSR_M01_BL_Out", "YD4_IPS_FSR_M02_BL_Out", "YD4_GRT_WO_FIT_PV_Out", "YD4_GRT_WO_FIT_TotalValue", "YD4_GRT_EO_FIT_PV_Out", "YD4_GRT_EO_FIT_TotalValue"],
    "3": ["YD4_IPS_CSR_M01_DI_RUN", "YD4_IPS_CSR_M02_DI_RUN", "YD4_IPS_CSR_SCV_DI_RUN", "YD4_IPS_CSR_SPS_DI_RUN", "YD4_IPS_SBP_P01_DI_RUN", "YD4_IPS_SBP_P02_DI_RUN", "YD4_IPS_SBP_P03_DI_RUN", "YD4_IPS_SBP_P04_DI_RUN", "YD4_IPS_FSR_M01_DI_RUN", "YD4_IPS_FSR_M02_DI_RUN", "YD4_IPS_FSR_SCV_DI_RUN", "YD4_IPS_FSR_SPS_DI_RUN", "YD4_IPS_FSR_GWS_DI_RUN", "YD4_IPS_RBL_B01_DI_RUN", "YD4_IPS_RBL_B02_DI_RUN", "YD4_IPS_RBL_B03_DI_RUN", "YD4_IPS_MIX_M01_DI_RUN", "YD4_IPS_MIX_M02_DI_RUN"],
    "4": ["YD4_GFJ410_B01_JKWDZ", "YD4_GFJ410_B01_CKWDZ", "YD4_GFJ410_B01_CKYLZ", "YD4_GFJ410_B01_LL", "YD4_GFJ410_B02_JKWDZ", "YD4_GFJ410_B02_CKWDZ", "YD4_GFJ410_B02_CKYLZ", "YD4_GFJ410_B02_LL", "YD4_GFJ410_B03_JKWDZ", "YD4_GFJ410_B03_CKWDZ", "YD4_GFJ410_B03_CKYLZ", "YD4_GFJ410_B03_LL", "YD4_GFJ410_B04_JKWDZ", "YD4_GFJ410_B04_CKWDZ", "YD4_GFJ410_B04_CKYLZ", "YD4_GFJ410_B04_LL", "YD4_GFJ410_B05_JKWDZ", "YD4_GFJ410_B05_CKWDZ", "YD4_GFJ410_B05_CKYLZ", "YD4_GFJ410_B05_LL", "YD4_GFJ410_B06_JKWDZ", "YD4_GFJ410_B06_CKWDZ", "YD4_GFJ410_B06_CKYLZ", "YD4_GFJ410_B06_LL"],
    "5": ["YD4_GFJ410_B01_DI_RUN", "YD4_GFJ410_B02_DI_RUN", "YD4_GFJ410_B03_DI_RUN", "YD4_GFJ410_B04_DI_RUN", "YD4_GFJ410_B05_DI_RUN", "YD4_GFJ410_B06_DI_RUN"],
    "6": ["YD4_AJP_LIT_PV_Out", "YD4_ST_SPW_LIT_PV_Out", "YD4_ST_SPW_FIT_PV_Out", "YD4_ST_SPW_FIT_TotalValue"],
    "7": ["YD4_AJP_MIX_M01_DI_RUN", "YD4_AJP_MIX_M02_DI_RUN", "YD4_AJP_MIX_M03_DI_RUN", "YD4_AJP_MIX_M04_DI_RUN", "YD4_AJP_CFP_P01_DI_RUN", "YD4_AJP_CFP_P02_DI_RUN", "YD4_AJP_CFP_P03_DI_RUN", "YD4_ST_FSP_P01_DI_RUN", "YD4_ST_FSP_P02_DI_RUN", "YD4_ST_SP_P01_DI_RUN", "YD4_ST_SP_P02_DI_RUN"],
    "8": ["YD4_MBR_E_DO_01_PV_Out", "YD4_MBR_E_DO_02_PV_Out", "YD4_MBR_E_DO_03_PV_Out", "YD4_MBR_E_DO_04_PV_Out", "YD4_MBR_E_DO_05_PV_Out", "YD4_MBR_E_ORP_01_PV_Out", "YD4_MBR_E_ORP_02_PV_Out", "YD4_MBR_E_ORP_03_PV_Out", "YD4_MBR_E_MLSS_PV_Out", "YD4_MBR_E_NO3_PV_Out", "YD4_MBR_E_FIT_AIR_01_PV_Out", "YD4_MBR_E_FIT_AIR_02_PV_Out", "YD4_MBR_E_FIT_AIR_03_PV_Out", "YD4_MBR_E_FIT_AIR_04_PV_Out", "YD4_MBR_E_FIT_AIR_05_PV_Out", "YD4_ABH_EO_PIT_AIR_PV_Out", "YD4_ABH_EO_FIT_AIR_PV_Out", "YD4_ABH_EO_FIT_AIR_TotalValue"],
    "9": ["YD4_MBR_E_MIX_01_DI_RUN", "YD4_MBR_E_MIX_02_DI_RUN", "YD4_MBR_E_MIX_03_DI_RUN", "YD4_MBR_E_MIX_04_DI_RUN", "YD4_MBR_E_MIX_05_DI_RUN", "YD4_MBR_E_MIX_06_DI_RUN", "YD4_MBR_E_MIX_07_DI_RUN", "YD4_MBR_E_MIX_08_DI_RUN", "YD4_MBR_E_MIX_09_DI_RUN", "YD4_MBR_E_MIX_10_DI_RUN", "YD4_MBR_E_MIX_11_DI_RUN", "YD4_MBR_E_MIX_12_DI_RUN", "YD4_MBR_E_IRP_01_DI_RUN", "YD4_MBR_E_IRP_02_DI_RUN", "YD4_MBR_E_IRP_03_DI_RUN"],
    "40": ["YD4_DEO1_JXB_P01_DI_RUN", "YD4_DEO1_JXB_P02_DI_RUN", "YD4_DEO1_SXSB_P01_DI_RUN", "YD4_DEO1_SXSB_P02_DI_RUN", "YD4_DEO1_VLP_P01_DI_RUN", "YD4_DEO1_VLP_P02_DI_RUN", "YD4_DEO1_PSB_P01_DI_RUN", "YD4_DEO1_CBL_B01_DI_RUN"],
    "20": ["YD4_HST_TP_PV_OUT", "YD4_HST_SS_PV_OUT", "YD4_HST_NO3N_PV_Out", "YD4_HST_FIT_01_DQLL", "YD4_HST_FIT_01_LLJ_LJ", "YD4_HST_FIT_02_DQLL", "YD4_HST_FIT_02_LLJ_LJ", "YD4_HST_FIT_03_DQLL", "YD4_HST_FIT_03_LLJ_LJ", "YD4_GXCDC_AIT006"],
    "21": ["YD4_HST_RSP_P01_DI_RUN", "YD4_HST_RSP_P02_DI_RUN", "YD4_HST_RSP_P03_DI_RUN", "YD4_HST_ESP_P01_DI_RUN", "YD4_HST_ESP_P02_DI_RUN", "YD4_HST_ESP_P03_DI_RUN", "YD4_HST_FAT_M01_DI_RUN", "YD4_HST_FAT_M02_DI_RUN", "YD4_HST_FAT_M03_DI_RUN", "YD4_HST_FAT_M04_DI_RUN", "YD4_HST_MIX_M01_DI_RUN", "YD4_HST_MIX_M02_DI_RUN", "YD4_HST_MIX_M03_DI_RUN", "YD4_HST_MIX_M04_DI_RUN"]
}

let hasTotal = false;
for (let i = 0; i < tagMap[label].length; i++) {
    let tagName = tagMap[label][i];
    if (tagName.indexOf("_FIT_TotalValue") !== -1 || tagName.indexOf("_PauseValue") !== -1 || tagName.indexOf("_LJ") !== -1 || tagName.indexOf("_FIT_I_L") !== -1 || tagName.indexOf("_FIT_O_L") !== -1) {
        hasTotal = true;
        break;
    }
}

$(Datagrid1.id).datagrid({
    data: [],
    fitColumns: false,
    pagination: true,
    nowrap: false,
    pageList: [50, 80, 100, 120, 150], //设置每页记录条数的列表
}); //清空
//自定义返回月的天数
function getDaysInMonth(year, month) {
    month = parseInt(month, 10);
    var temp = new Date(year, month, '0');
    return temp.getDate();
}
//自定义返回增加的n天的日期
function getaddriqi(year, month, day, n) {
    var temp = new Date(year, month - 1, day);
    temp = new Date(temp.getTime() + 24 * 60 * 60 * 1000 * n);
    temp = temp.format('yyyy-MM-dd');
    return temp;
}
let SLRQ = new Date(DateTimeBox1.Value)
let year1 = SLRQ.getFullYear(); //返回所选年份
let month1 = SLRQ.getMonth() + 1; //返回所选月份
let day1 = SLRQ.getDate(); //返回所选天
let getmonthday = getDaysInMonth(year1, month1); //自定义返回月的天数
// 获取到开始时间后面的日期时间框的数据
let startTime;
// 获取到结束时间后面的日期时间框的数据
let endTime;
let endTimeacc;
var endtnum;
var type1;
var maxendtime, maxendtnum;
let currriqi = $System.$Date;
currriqi = currriqi.replace(/\//g, "-");
// 查询间隔时间
//let timebucket = "60m";
let timebucket = 间隔.GetCurrentText() + "m";
let reporttype;
if (报表类型.GetCurrentText() === '日报表') {
    type1 = 0;
    reporttype = "日报表";
    startTime = DateTimeBox1.Value + ' 00:00:05';
    endTime = DateTimeBox1.Value + ' 23:59:59';
    endTimeacc = getaddriqi(year1, month1, day1, 1) + ' 00:00:05';
    if (currriqi === DateTimeBox1.Value) {
        var currTime = new Date();
        endTime = currTime.format('yyyy-MM-dd hh:mm:ss');
        endTimeacc = endTime;
    }
    endtnum = new Date(DateTimeBox1.Value);
    maxendtime = getaddriqi($System.$Year, $System.$Month, $System.$Day, 0);
    maxendtnum = new Date(maxendtime);
} else if (报表类型.GetCurrentText() === '月报表') {
    type1 = 1;
    reporttype = "月报表";
    timebucket = "1d";
    startTime = getaddriqi(year1, month1, 1, 0) + ' 00:00:00';
    endTime = getaddriqi(year1, month1, getmonthday, 0) + ' 23:59:59';
    endTimeacc = getaddriqi(year1, month1, getmonthday, 1) + ' 00:00:05';
    if (year1 == $System.$Year && month1 == $System.$Month) {
        var currTime1 = new Date();
        endTime = currTime1.format('yyyy-MM-dd hh:mm:ss');
        endTimeacc = endTime;
    }
    endtnum = new Date(getaddriqi(year1, month1, getmonthday, 1));
    maxendtime = getaddriqi($System.$Year, $System.$Month, getDaysInMonth($System.$Year, $System.$Month), 1);
    maxendtnum = new Date(maxendtime);
} else if (报表类型.GetCurrentText() === '年报表') {
    type1 = -1;
    reporttype = "年报表";
    timebucket = "1n";
    startTime = getaddriqi(year1, 1, 1, 0) + ' 00:00:00';
    endTime = getaddriqi(year1, 12, 31, 0) + ' 23:59:59';
    endTimeacc = getaddriqi(year1 + 1, 1, 1, 0) + ' 00:00:05';
    if (year1 == $System.$Year && month1 <= $System.$Month) {
        var currTime1 = new Date();
        endTime = currTime1.format('yyyy-MM-dd hh:mm:ss');
        endTimeacc = endTime;
    }
    endtnum = new Date(getaddriqi(year1, 12, 31, 1));
    maxendtime = getaddriqi($System.$Year, 12, 31, 1);
    maxendtnum = new Date(maxendtime);
}
let datatype;
if (数据类型.GetCurrentText() === '瞬时') {
    datatype = 'data_first';
} else if (数据类型.GetCurrentText() === '平均') {
    datatype = 'data_average';
} else if (数据类型.GetCurrentText() === '最大') {
    datatype = 'data_max';
} else if (数据类型.GetCurrentText() === '最小') {
    datatype = 'data_min';
}
if (报表类型.GetCurrentText() === '月报表' || 报表类型.GetCurrentText() === '年报表') {数据类型.SetCurrentText
    datatype = 'data_first';
}
startTime = startTime.replace(/\//g, "-");
endTime = endTime.replace(/\//g, "-");
//判断
if (endtnum > maxendtnum) {
    alert('时间选择错误！');
} else if (datatype === 'data_first') {
    let options;
    if (hasTotal) {
        options = {
            "type": type1,
            "startTime": startTime,
            "endTime": endTimeacc,
            "timebucket": timebucket,
            "tags": tagMap[label],
            "columns": []
        };
    } else {
        options = {
            "type": type1,
            "startTime": startTime,
            "endTime": endTime,
            "timebucket": timebucket,
            "tags": tagMap[label],
            "columns": []
        };
    }
    GetHistorytagForReport(options, function(res) {
        debugger
        datadealfun(res.Body.records)
    })
} else {
    let options;
    if (hasTotal) {
        options = {
            "type": type1,
            "startTime": startTime,
            "endTime": endTimeacc,
            "timebucket": timebucket,
            "tags": tagMap[label],
            "columns": ["max", "min", "last", "avg"],
            "isDesc": false
        };
    } else {
        ooptions = {
            "type": type1,
            "startTime": startTime,
            "endTime": endTime,
            "timebucket": timebucket,
            "tags": tagMap[label],
            "columns": ["max", "min", "last", "avg"],
            "isDesc": false
        };
    }
    GetHistorytagForCurve(options, function(res) {
        debugger
        datadealfun(res.Body.records)
    });
}

function datadealfun(res) {
    let dataY = [];
    let arrLen = 0;
    for (const key in res) {
        if (res[key].length > arrLen) {
            arrLen = res[key].length;
        }
    }
    if (hasTotal || endTime === endTimeacc) {
        arrLen = arrLen - 1;
    }
    for (let i = 0; i < arrLen; i++) {
        let dataT = {};
        //max:datamax min:datamin avg:dataaverage
        dataT.time = null;
        let zll123 = null;
        let zll4 = null;
        let zll1234 = null;
        for (let j = 0; j < tagMap[label].length; j++) {
            if (dataT.time === null) {
                if (res[tagMap[label][j]] && res[tagMap[label][j]][i] && res[tagMap[label][j]][i].period) {
                    dataT.time = res[tagMap[label][j]][i].period;
                    var sj = new Date(dataT.time);
                    dataT.time = sj.format('hh:00:00');
                    if (报表类型.GetCurrentText() === '月报表') {
                        dataT.time = sj.format('yyyy-MM-dd');
                    }
                    if (报表类型.GetCurrentText() === '年报表') {
                        dataT.time = sj.format('yyyy-MM');
                    }
                }
            }
            if (res[tagMap[label][j]] && res[tagMap[label][j]][i]) {
                if (tagMap[label][j].indexOf("_FIT_TotalValue") !== -1 || tagMap[label][j].indexOf("_PauseValue") !== -1 || tagMap[label][j].indexOf("_LJ") !== -1 || tagMap[label][j].indexOf("_FIT_I_L") !== -1 || tagMap[label][j].indexOf("_FIT_O_L") !== -1) {
                    let thisData = res[tagMap[label][j]][i][datatype] ? parseFloat(res[tagMap[label][j]][i][datatype].toFixed(2)) : 0;
                    let nextData = res[tagMap[label][j]][i + 1][datatype] ? parseFloat(res[tagMap[label][j]][i + 1][datatype].toFixed(2)) : 0;
                    if(thisData === 0 || nextData=== 0){
                        dataT[tagMap[label][j]] = 0;
                    }else{
                        dataT[tagMap[label][j]] = parseFloat((nextData - thisData).toFixed(2));
                    }
                } else {
                    dataT[tagMap[label][j]] = res[tagMap[label][j]][i][datatype] ? parseFloat(res[tagMap[label][j]][i][datatype].toFixed(2)) : 0
                }
            }
            if (label === 'total'){
                if (["YD_ANP_A_FIT_I_L","YD_ANP_B_FIT_I_L","YD_ANP_C_FIT_I_L","YD_ANP_D_FIT_I_L","YD_ANP_E_FIT_I_L","YD_ANP_F_FIT_I_L","YD_GRT_FIT_O_L"].indexOf(tagMap[label][j]) !== -1){
                    let addData = dataT[tagMap[label][j]];
                    if (addData == null){
                        addData = 0;
                    }
                    zll123 += addData;
                    zll1234 += addData;
                }else if (["YD4_GRT_EO_FIT_TotalValue","YD4_GRT_WO_FIT_TotalValue"].indexOf(tagMap[label][j]) !== -1){
                    let addData = dataT[tagMap[label][j]];
                    if (addData == null){
                        addData = 0;
                    }
                    zll4 += addData;
                    zll1234 += addData;
                }
            }
        }
        if (label === 'total'){
            dataT["123zll"] = zll123;
            dataT["4zll"] = zll4;
            dataT["1234zll"] = zll1234;
        }
        dataY.push(dataT);
    }
    console.log(dataY);
    //计算数据
    //最大值判断函数定义
    Array.prototype.max = function() {
        var max = this[0];
        this.forEach(function(ele, index, arr) {
            if (ele > max) {
                max = ele;
            }
        })
        return max;
    }
    //最小值判断函数定义
    Array.prototype.min = function() {
        var min = this[0];
        this.forEach(function(ele, index, arr) {
            if (ele < min) {
                min = ele;
            }
        })
        return min;
    }
    //最小值
    let minData = {}
    minData.time = '最小值';
    for (let i = 0; i < tagMap[label].length; i++) {
        let dataArr = [];
        for (var iq = 0; iq < dataY.length; iq++) {
            if (dataY[iq][tagMap[label][i]] !== null && dataY[iq][tagMap[label][i]] !== undefined) {
                dataArr.push(dataY[iq][tagMap[label][i]])
            }
        }
        if (dataArr.length > 0) {
            let min = dataArr.min();
            minData[tagMap[label][i]] = min;
        }
    }
    let maxData = {}
    maxData.time = '最大值';
    for (let i = 0; i < tagMap[label].length; i++) {
        let dataArr = [];
        for (var iq = 0; iq < dataY.length; iq++) {
            if (dataY[iq][tagMap[label][i]] !== null && dataY[iq][tagMap[label][i]] !== undefined) {
                dataArr.push(dataY[iq][tagMap[label][i]])
            }
        }
        if (dataArr.length > 0) {
            let max = dataArr.max();
            maxData[tagMap[label][i]] = max;
        }
    }
    let avgData = {}
    avgData.time = '平均值';
    var sumFunc = function(x, y) {
        return x + y;
    }; //求和
    for (let i = 0; i < tagMap[label].length; i++) {
        let dataArr = [];
        for (var iq = 0; iq < dataY.length; iq++) {
            if (dataY[iq][tagMap[label][i]] !== null && dataY[iq][tagMap[label][i]] !== undefined) {
                dataArr.push(dataY[iq][tagMap[label][i]])
            }
        }
        if (dataArr.length > 0) {
            let sum = dataArr.reduce(sumFunc);
            let avg = parseFloat((sum / dataArr.length).toFixed(2));
            avgData[tagMap[label][i]] = avg;
        }
    }
    let cumulativeData = {}
    cumulativeData.time = '累计值';
    var sumFunc = function(x, y) {
        return x + y;
    }; //求和
    for (let i = 0; i < tagMap[label].length; i++) {
        if (tagMap[label][i].indexOf("_FIT_TotalValue") !== -1
            || tagMap[label][i].indexOf("_PauseValue") !== -1
            || tagMap[label][i].indexOf("_LJ") !== -1
            || tagMap[label][i].indexOf("_FIT_I_L") !== -1
            || tagMap[label][i].indexOf("_FIT_O_L") !== -1
            || tagMap[label][i].indexOf("123zll") !== -1
            || tagMap[label][i].indexOf("1234zll") !== -1
            || tagMap[label][i].indexOf("4zll") !== -1) {
            let dataArr = [];
            for (var iq = 0; iq < dataY.length; iq++) {
                if (dataY[iq][tagMap[label][i]] !== null && dataY[iq][tagMap[label][i]] !== undefined) {
                    dataArr.push(dataY[iq][tagMap[label][i]])
                }
            }
            if (dataArr.length > 0) {
                let sum = dataArr.reduce(sumFunc);
                cumulativeData[tagMap[label][i]] = parseFloat(sum.toFixed(2));
            }
        }else{
            cumulativeData[tagMap[label][i]] = null;
        }

    }
    dataY.push(minData);
    dataY.push(maxData);
    dataY.push(avgData);
    if(hasTotal){
        dataY.push(cumulativeData);
    }

    console.log(dataY);
    //数据网格分页显示
    var tmpData = dataY.slice(0, 50);
    $(Datagrid1.id).datagrid({
        data: tmpData,
        fitColumns: false,
        pagination: true,
        nowrap: false,
        pageList: [50, 80, 100, 120, 150], //设置每页记录条数的列表
    });
    var pager = $(Datagrid1.id).datagrid("getPager"); //数据网格分页对象
    pager.pagination({
        total: dataY.length,
        beforePageText: '第', //页数文本框前显示的汉字
        afterPageText: '页     共 {pages} 页',
        displayMsg: '当前显示 {from} - {to} 条记录    共 {total} 条记录',
        onSelectPage: function(pageNo, pageSize) {
            var start = (pageNo - 1) * pageSize;
            var end = start + pageSize;
            tmpData = dataY.slice(start, end);
            $(Datagrid1.id).datagrid("loadData", tmpData);
            pager.pagination('refresh', {
                total: dataY.length,
                pageNumber: pageNo,
            });
        }
    });
}